home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 15487 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  3.3 KB

  1. Path: in2.uu.net!novia!usenet
  2. From: srwillrd@novia.net (William E. Kempf)
  3. Newsgroups: comp.lang.c++,comp.lang.c,comp.os.msdos.programer,comp.os.ms-windows.programmer.misc
  4. Subject: Re: fastest code
  5. Date: Fri, 05 Apr 1996 21:12:21 GMT
  6. Organization: Novia Internetworking <> 28.8kbps dialup; 402/390-2NET
  7. Message-ID: <31658942.99299605@204.248.25.97>
  8. References: <316112A2.7D37@public.sta.net.cn> <31611AC9.7DE1@wight.hursley.ibm.com> <3162c21a.6084138@204.248.25.97> <31641DE2.31D4@halcyon.com>
  9. NNTP-Posting-Host: 167.16.65.84
  10. X-Newsreader: Forte Agent .99e/32.201
  11.  
  12. Glen Parker <glenebob@halcyon.com> wrote:
  13.  
  14. :William E. Kempf wrote:
  15. :> 
  16. :> Max Waterman <dwater@wight.hursley.ibm.com> wrote:
  17. :> 
  18. :> :Xu Yifeng wrote:
  19. :> :> I'd like to know which C/C++ compiler generate fastest code?
  20. :> :> Borland, Microsoft, Watcom, High or Symantec?
  21. :> :
  22. :> :The Cray C compiler would probably generate the fastest code.
  23. :> :
  24. :> :Max.
  25. :> :--
  26. :> :    ___                      mailto:max@lton.u-net.com
  27. :> :  /  /  /  _       /     /  _  __ __   _   __   _
  28. :> : /  /  / /_/ |/  /  /  / /_/  /  /_   /_/ / / / /_/ /| /
  29. :> :/  /  / /  / /|  /_/_/ /  /  /  /_  /  |  / / / /  / / |/
  30. :> 
  31. :> No, it may run faster because the Cray computer is faster, but that
  32. :> doesn't mean it is faster code (Big-O notation kinda thing) :-).
  33. :> 
  34. :> -----
  35. :> William E. Kempf          : http://www.novia.net/~srwillrd
  36. :> "Sir Willard"             : mailto:srwillrd@novia.net (home)
  37. :> Knight of the Ascii Table : mailto:wekempf@marlton.1dc.com (work)
  38. :
  39. :
  40. :If you run a c-compiler on a faster computer, 
  41. :wouldn't it make faster code?  Or code faster?  Now 
  42. :I'm confused
  43. :
  44. :
  45. Ok, my cutsy remark has confused several people, so I will explain.
  46. In computer science, algorithms (and this will apply to the final
  47. machine code generated by a compiler) are evaluated for speed in a
  48. system independant way, through a formula known as Big-O notation.  So
  49. code is not said to be faster just because it is running on a faster
  50. machine.  The executable program may be faster, but the underlying
  51. code may not be.  All kinds of things can effect this, such as wether
  52. or not the compiler moves variable declarations outside of loops, etc.
  53.  
  54. As an example:  if the C code looked like this...
  55.  
  56. while (condition)
  57. {
  58.    a = 10;
  59.    // other code that does not change a
  60. }
  61.  
  62. a good optimizing compiler would move the a = 10 statement before the
  63. loop in the final machine code.  If an Intel based compiler made this
  64. optimization while the Cray c-compiler did not, the Intel compiler
  65. would have generated faster "code", while the Cray c-compiler would
  66. still have an executable that runs quicker, simply because the Cray is
  67. quicker.
  68.  
  69. The original question was looking for this kind of information (even
  70. if the poster does not understand Big-O, which I don't know if he did
  71. or not).  He wants to know what compiler will best optimize the
  72. machine language code generated for a specific OS and computer
  73. architecture.
  74.  
  75. I don't have the answer to his question, as the compilers are changing
  76. at such a rate they would need to be re-bench marked with every new
  77. release.  I do know that at one time Watcomm was the fastest, but I
  78. don't know if this is still true.
  79.  
  80. -----
  81. William E. Kempf          : http://www.novia.net/~srwillrd
  82. "Sir Willard"             : mailto:srwillrd@novia.net (home)
  83. Knight of the Ascii Table : mailto:wekempf@marlton.1dc.com (work)
  84.